home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / zbpc_460.zip / UTILITY.EXE / PERCENT.BAS < prev    next >
BASIC Source File  |  1991-04-11  |  2KB  |  52 lines

  1. 'Demonstrates the use of GET and PUT in text modes to save a screen where a
  2. 'Pop-up window will be done, then quickly restore it when the window pops down.
  3.  
  4.  
  5.  
  6.  
  7. CLEAR
  8. COLOR,79 : CLS : DEFINT A-Z
  9. COORDINATE WINDOW 'Do this to save memory in array size in text modes
  10. DIM A(430)
  11.  
  12. PRINT@(13,16)"Illustrates a pop-up window which shows percentage of a"
  13. PRINT@(13,17)"task completed, then pops down and restores the previous"
  14. PRINT@(13,18)"screen which was loaded into the array using GET in text"
  15. PRINT@(13,19)"mode and restored with PUT."
  16. PRINT@(25,21)"Press any key to begin demonstration"
  17.  
  18. GET(10,15)-(70,21),A(1)
  19. 'Load text into array for restore when window pops down
  20.  
  21. "Begin" IF INKEY$ = "" GOTO "Begin"
  22.  
  23. 'Define window size and set colors
  24. DEF PAGE 10,15 TO 70,20 : COLOR ,31 : CLS
  25.  
  26. 'Do window borders
  27. PRINT@(10,15) CHR$(218) + STRING$ (58,196) + CHR$(191);
  28. FOR X = 16 TO 20 : PRINT@(10,X) CHR$(179) + STRING$ (58,32) + CHR$(179); : NEXT
  29. PRINT@(10,21) CHR$(192) + STRING$ (58,196) + CHR$(217)" ";
  30.  
  31. 'Start dummy execution
  32. FOR X = 1 TO 100 : COLOR,79 : PRINT@(38,2) RND(5000);
  33.  
  34. 'Display percentage done
  35. COLOR,31 : PRINT@(15,16) STRING$(X/2,177); : PRINT@(30,18) X"% Completed";
  36. FOR Y = 1 TO 5000 : NEXT Y,X
  37.  
  38. 'Ask for command to pop down and restore screen
  39. PRINT@(30,20)"Any key to restore";
  40.  
  41. "Delay" IF INKEY$ = "" GOTO "Delay"
  42.  
  43. 'Restore full screen DEF PAGE
  44. DEF PAGE 0,0 TO 79,24
  45.  
  46. 'Restore screen from array
  47. PUT(10,15),A(1)
  48.  
  49. 'Freeze until keypress
  50. "Delay1" IF INKEY$ = "" GOTO "Delay1"
  51. CLS
  52.